-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: sensor abstraction & hardware setup file #271
Draft
ROMemories
wants to merge
25
commits into
future-proof-iot:main
Choose a base branch
from
ROMemories:feat/hwconfig
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROMemories
added
sensor
Specific sensor support
board
Board support
sensor api
The sensor API
labels
Apr 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft PR of the current state of the sensor abstraction layer and hardware setup file. It will definitely be split up when time comes.
Current implementation:
await_read_sensor_main!
function-like proc-macro reads the list of sensor concrete types fromhw-setup.yml
_await_read_sensor_main!
declarative macro downcasts the sensor trait object to a concrete type, reads the "main" sensor value and awaits it (required because different opaque types otherwise)riot_rs::hw_setup
attribute macro populate thesensors
application modules with sensor driver instantiation and initialization (to be completed)Major pieces which are currently missing:
Sensor
trait for each sensor categories (e.g., temperature sensors, accelerometers, …) so that it is easy to replace a sensor with another one from the same categoryPoints of interests:
Sensor
trait has two "read" methods:Sensor::read_main()
(which needs a better name), which provides a consistent interface across all categories of sensors (and thus only returns the "main" value returned by the sensor) and should return anenum
to allow for multi-dimensional tuples, andSensor::read()
method, which returns a type implementingReading
, allowing each sensor to return a custom type (this should change when introducing sensor categories).